package collections;

import java.util.*;

public class Iterator1
{
    public static void main(String args[])
    {
        List list = new ArrayList();
        list.add("abc");
        list.add("def");
        list.add("ghi");

        ListIterator iter1 = list.listIterator();
        boolean first = true;
        while (iter1.hasNext())
        {
            System.out.println(iter1.next());
            // list.add("xyz");
            if (first)
            {
                iter1.add("xyz");
                first = false;
            }
        }
    }
}
